package com.example.zm_fanjiantao.exception;

import com.example.zm_fanjiantao.utils.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
//@ControllerAdvice
//@ResponseBody
public class SystemErrorMethod {

    @ExceptionHandler(ErrorInterception.class)
    public Result handelException(ErrorInterception e){
        return Result.fail(e.getMessage());
    }
    @ExceptionHandler(Exception.class)
    public Result exception(){
         return Result.fail(null);
    }
}
